3.815 \(\int \frac{\left (a+b x+c x^2\right )^2}{(d+e x) (f+g x)} \, dx\)

Optimal. Leaf size=184 \[ \frac{x \left (-2 c e g (-a e g+b d g+b e f)+b^2 e^2 g^2+c^2 \left (d^2 g^2+d e f g+e^2 f^2\right )\right )}{e^3 g^3}+\frac{\log (d+e x) \left (a e^2-b d e+c d^2\right )^2}{e^4 (e f-d g)}-\frac{\log (f+g x) \left (a g^2-b f g+c f^2\right )^2}{g^4 (e f-d g)}-\frac{c x^2 (-2 b e g+c d g+c e f)}{2 e^2 g^2}+\frac{c^2 x^3}{3 e g} \]

[Out]

((b^2*e^2*g^2 - 2*c*e*g*(b*e*f + b*d*g - a*e*g) + c^2*(e^2*f^2 + d*e*f*g + d^2*g
^2))*x)/(e^3*g^3) - (c*(c*e*f + c*d*g - 2*b*e*g)*x^2)/(2*e^2*g^2) + (c^2*x^3)/(3
*e*g) + ((c*d^2 - b*d*e + a*e^2)^2*Log[d + e*x])/(e^4*(e*f - d*g)) - ((c*f^2 - b
*f*g + a*g^2)^2*Log[f + g*x])/(g^4*(e*f - d*g))

_______________________________________________________________________________________

Rubi [A]  time = 0.603069, antiderivative size = 184, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 1, integrand size = 27, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.037 \[ \frac{x \left (-2 c e g (-a e g+b d g+b e f)+b^2 e^2 g^2+c^2 \left (d^2 g^2+d e f g+e^2 f^2\right )\right )}{e^3 g^3}+\frac{\log (d+e x) \left (a e^2-b d e+c d^2\right )^2}{e^4 (e f-d g)}-\frac{\log (f+g x) \left (a g^2-b f g+c f^2\right )^2}{g^4 (e f-d g)}-\frac{c x^2 (-2 b e g+c d g+c e f)}{2 e^2 g^2}+\frac{c^2 x^3}{3 e g} \]

Antiderivative was successfully verified.

[In]  Int[(a + b*x + c*x^2)^2/((d + e*x)*(f + g*x)),x]

[Out]

((b^2*e^2*g^2 - 2*c*e*g*(b*e*f + b*d*g - a*e*g) + c^2*(e^2*f^2 + d*e*f*g + d^2*g
^2))*x)/(e^3*g^3) - (c*(c*e*f + c*d*g - 2*b*e*g)*x^2)/(2*e^2*g^2) + (c^2*x^3)/(3
*e*g) + ((c*d^2 - b*d*e + a*e^2)^2*Log[d + e*x])/(e^4*(e*f - d*g)) - ((c*f^2 - b
*f*g + a*g^2)^2*Log[f + g*x])/(g^4*(e*f - d*g))

_______________________________________________________________________________________

Rubi in Sympy [F]  time = 0., size = 0, normalized size = 0. \[ \frac{c^{2} x^{3}}{3 e g} + \frac{c \left (2 b e g - c d g - c e f\right ) \int x\, dx}{e^{2} g^{2}} + \frac{\left (2 a c e^{2} g^{2} + b^{2} e^{2} g^{2} - 2 b c d e g^{2} - 2 b c e^{2} f g + c^{2} d^{2} g^{2} + c^{2} d e f g + c^{2} e^{2} f^{2}\right ) \int \frac{1}{e^{3}}\, dx}{g^{3}} + \frac{\left (a g^{2} - b f g + c f^{2}\right )^{2} \log{\left (f + g x \right )}}{g^{4} \left (d g - e f\right )} - \frac{\left (a e^{2} - b d e + c d^{2}\right )^{2} \log{\left (d + e x \right )}}{e^{4} \left (d g - e f\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  rubi_integrate((c*x**2+b*x+a)**2/(e*x+d)/(g*x+f),x)

[Out]

c**2*x**3/(3*e*g) + c*(2*b*e*g - c*d*g - c*e*f)*Integral(x, x)/(e**2*g**2) + (2*
a*c*e**2*g**2 + b**2*e**2*g**2 - 2*b*c*d*e*g**2 - 2*b*c*e**2*f*g + c**2*d**2*g**
2 + c**2*d*e*f*g + c**2*e**2*f**2)*Integral(e**(-3), x)/g**3 + (a*g**2 - b*f*g +
 c*f**2)**2*log(f + g*x)/(g**4*(d*g - e*f)) - (a*e**2 - b*d*e + c*d**2)**2*log(d
 + e*x)/(e**4*(d*g - e*f))

_______________________________________________________________________________________

Mathematica [A]  time = 0.272458, size = 177, normalized size = 0.96 \[ -\frac{e g x (d g-e f) \left (6 c e g (2 a e g+b (-2 d g-2 e f+e g x))+6 b^2 e^2 g^2+c^2 \left (6 d^2 g^2-3 d e g (g x-2 f)+e^2 \left (6 f^2-3 f g x+2 g^2 x^2\right )\right )\right )-6 g^4 \log (d+e x) \left (e (a e-b d)+c d^2\right )^2+6 e^4 \log (f+g x) \left (g (a g-b f)+c f^2\right )^2}{6 e^4 g^4 (e f-d g)} \]

Antiderivative was successfully verified.

[In]  Integrate[(a + b*x + c*x^2)^2/((d + e*x)*(f + g*x)),x]

[Out]

-(e*g*(-(e*f) + d*g)*x*(6*b^2*e^2*g^2 + 6*c*e*g*(2*a*e*g + b*(-2*e*f - 2*d*g + e
*g*x)) + c^2*(6*d^2*g^2 - 3*d*e*g*(-2*f + g*x) + e^2*(6*f^2 - 3*f*g*x + 2*g^2*x^
2))) - 6*(c*d^2 + e*(-(b*d) + a*e))^2*g^4*Log[d + e*x] + 6*e^4*(c*f^2 + g*(-(b*f
) + a*g))^2*Log[f + g*x])/(6*e^4*g^4*(e*f - d*g))

_______________________________________________________________________________________

Maple [B]  time = 0.015, size = 444, normalized size = 2.4 \[{\frac{{c}^{2}{x}^{3}}{3\,eg}}+{\frac{b{x}^{2}c}{eg}}-{\frac{{x}^{2}{c}^{2}d}{2\,{e}^{2}g}}-{\frac{{x}^{2}{c}^{2}f}{2\,e{g}^{2}}}+2\,{\frac{acx}{eg}}+{\frac{{b}^{2}x}{eg}}-2\,{\frac{bcdx}{{e}^{2}g}}-2\,{\frac{bcfx}{e{g}^{2}}}+{\frac{{c}^{2}{d}^{2}x}{{e}^{3}g}}+{\frac{{c}^{2}dfx}{{e}^{2}{g}^{2}}}+{\frac{{c}^{2}{f}^{2}x}{e{g}^{3}}}+{\frac{\ln \left ( gx+f \right ){a}^{2}}{dg-ef}}-2\,{\frac{\ln \left ( gx+f \right ) abf}{ \left ( dg-ef \right ) g}}+2\,{\frac{\ln \left ( gx+f \right ) ac{f}^{2}}{{g}^{2} \left ( dg-ef \right ) }}+{\frac{\ln \left ( gx+f \right ){b}^{2}{f}^{2}}{{g}^{2} \left ( dg-ef \right ) }}-2\,{\frac{\ln \left ( gx+f \right ) bc{f}^{3}}{{g}^{3} \left ( dg-ef \right ) }}+{\frac{\ln \left ( gx+f \right ){c}^{2}{f}^{4}}{{g}^{4} \left ( dg-ef \right ) }}-{\frac{\ln \left ( ex+d \right ){a}^{2}}{dg-ef}}+2\,{\frac{\ln \left ( ex+d \right ) abd}{ \left ( dg-ef \right ) e}}-2\,{\frac{\ln \left ( ex+d \right ) ac{d}^{2}}{{e}^{2} \left ( dg-ef \right ) }}-{\frac{\ln \left ( ex+d \right ){b}^{2}{d}^{2}}{{e}^{2} \left ( dg-ef \right ) }}+2\,{\frac{\ln \left ( ex+d \right ) bc{d}^{3}}{{e}^{3} \left ( dg-ef \right ) }}-{\frac{\ln \left ( ex+d \right ){c}^{2}{d}^{4}}{{e}^{4} \left ( dg-ef \right ) }} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  int((c*x^2+b*x+a)^2/(e*x+d)/(g*x+f),x)

[Out]

1/3*c^2*x^3/e/g+1/e/g*x^2*b*c-1/2/e^2/g*x^2*c^2*d-1/2/e/g^2*x^2*c^2*f+2/e/g*a*c*
x+1/e/g*b^2*x-2/e^2/g*b*c*d*x-2/e/g^2*b*c*f*x+1/e^3/g*c^2*d^2*x+1/e^2/g^2*c^2*d*
f*x+1/e/g^3*c^2*f^2*x+1/(d*g-e*f)*ln(g*x+f)*a^2-2/g/(d*g-e*f)*ln(g*x+f)*a*b*f+2/
g^2/(d*g-e*f)*ln(g*x+f)*a*c*f^2+1/g^2/(d*g-e*f)*ln(g*x+f)*b^2*f^2-2/g^3/(d*g-e*f
)*ln(g*x+f)*b*c*f^3+1/g^4/(d*g-e*f)*ln(g*x+f)*c^2*f^4-1/(d*g-e*f)*ln(e*x+d)*a^2+
2/e/(d*g-e*f)*ln(e*x+d)*a*b*d-2/e^2/(d*g-e*f)*ln(e*x+d)*a*c*d^2-1/e^2/(d*g-e*f)*
ln(e*x+d)*b^2*d^2+2/e^3/(d*g-e*f)*ln(e*x+d)*b*c*d^3-1/e^4/(d*g-e*f)*ln(e*x+d)*c^
2*d^4

_______________________________________________________________________________________

Maxima [A]  time = 0.696315, size = 344, normalized size = 1.87 \[ \frac{{\left (c^{2} d^{4} - 2 \, b c d^{3} e - 2 \, a b d e^{3} + a^{2} e^{4} +{\left (b^{2} + 2 \, a c\right )} d^{2} e^{2}\right )} \log \left (e x + d\right )}{e^{5} f - d e^{4} g} - \frac{{\left (c^{2} f^{4} - 2 \, b c f^{3} g - 2 \, a b f g^{3} + a^{2} g^{4} +{\left (b^{2} + 2 \, a c\right )} f^{2} g^{2}\right )} \log \left (g x + f\right )}{e f g^{4} - d g^{5}} + \frac{2 \, c^{2} e^{2} g^{2} x^{3} - 3 \,{\left (c^{2} e^{2} f g +{\left (c^{2} d e - 2 \, b c e^{2}\right )} g^{2}\right )} x^{2} + 6 \,{\left (c^{2} e^{2} f^{2} +{\left (c^{2} d e - 2 \, b c e^{2}\right )} f g +{\left (c^{2} d^{2} - 2 \, b c d e +{\left (b^{2} + 2 \, a c\right )} e^{2}\right )} g^{2}\right )} x}{6 \, e^{3} g^{3}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((c*x^2 + b*x + a)^2/((e*x + d)*(g*x + f)),x, algorithm="maxima")

[Out]

(c^2*d^4 - 2*b*c*d^3*e - 2*a*b*d*e^3 + a^2*e^4 + (b^2 + 2*a*c)*d^2*e^2)*log(e*x
+ d)/(e^5*f - d*e^4*g) - (c^2*f^4 - 2*b*c*f^3*g - 2*a*b*f*g^3 + a^2*g^4 + (b^2 +
 2*a*c)*f^2*g^2)*log(g*x + f)/(e*f*g^4 - d*g^5) + 1/6*(2*c^2*e^2*g^2*x^3 - 3*(c^
2*e^2*f*g + (c^2*d*e - 2*b*c*e^2)*g^2)*x^2 + 6*(c^2*e^2*f^2 + (c^2*d*e - 2*b*c*e
^2)*f*g + (c^2*d^2 - 2*b*c*d*e + (b^2 + 2*a*c)*e^2)*g^2)*x)/(e^3*g^3)

_______________________________________________________________________________________

Fricas [A]  time = 0.599989, size = 423, normalized size = 2.3 \[ \frac{6 \,{\left (c^{2} d^{4} - 2 \, b c d^{3} e - 2 \, a b d e^{3} + a^{2} e^{4} +{\left (b^{2} + 2 \, a c\right )} d^{2} e^{2}\right )} g^{4} \log \left (e x + d\right ) + 2 \,{\left (c^{2} e^{4} f g^{3} - c^{2} d e^{3} g^{4}\right )} x^{3} - 3 \,{\left (c^{2} e^{4} f^{2} g^{2} - 2 \, b c e^{4} f g^{3} -{\left (c^{2} d^{2} e^{2} - 2 \, b c d e^{3}\right )} g^{4}\right )} x^{2} + 6 \,{\left (c^{2} e^{4} f^{3} g - 2 \, b c e^{4} f^{2} g^{2} +{\left (b^{2} + 2 \, a c\right )} e^{4} f g^{3} -{\left (c^{2} d^{3} e - 2 \, b c d^{2} e^{2} +{\left (b^{2} + 2 \, a c\right )} d e^{3}\right )} g^{4}\right )} x - 6 \,{\left (c^{2} e^{4} f^{4} - 2 \, b c e^{4} f^{3} g - 2 \, a b e^{4} f g^{3} + a^{2} e^{4} g^{4} +{\left (b^{2} + 2 \, a c\right )} e^{4} f^{2} g^{2}\right )} \log \left (g x + f\right )}{6 \,{\left (e^{5} f g^{4} - d e^{4} g^{5}\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((c*x^2 + b*x + a)^2/((e*x + d)*(g*x + f)),x, algorithm="fricas")

[Out]

1/6*(6*(c^2*d^4 - 2*b*c*d^3*e - 2*a*b*d*e^3 + a^2*e^4 + (b^2 + 2*a*c)*d^2*e^2)*g
^4*log(e*x + d) + 2*(c^2*e^4*f*g^3 - c^2*d*e^3*g^4)*x^3 - 3*(c^2*e^4*f^2*g^2 - 2
*b*c*e^4*f*g^3 - (c^2*d^2*e^2 - 2*b*c*d*e^3)*g^4)*x^2 + 6*(c^2*e^4*f^3*g - 2*b*c
*e^4*f^2*g^2 + (b^2 + 2*a*c)*e^4*f*g^3 - (c^2*d^3*e - 2*b*c*d^2*e^2 + (b^2 + 2*a
*c)*d*e^3)*g^4)*x - 6*(c^2*e^4*f^4 - 2*b*c*e^4*f^3*g - 2*a*b*e^4*f*g^3 + a^2*e^4
*g^4 + (b^2 + 2*a*c)*e^4*f^2*g^2)*log(g*x + f))/(e^5*f*g^4 - d*e^4*g^5)

_______________________________________________________________________________________

Sympy [A]  time = 117.993, size = 989, normalized size = 5.38 \[ \text{result too large to display} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((c*x**2+b*x+a)**2/(e*x+d)/(g*x+f),x)

[Out]

c**2*x**3/(3*e*g) + (a*g**2 - b*f*g + c*f**2)**2*log(x + (a**2*d*e**3*g**4 + a**
2*e**4*f*g**3 - 4*a*b*d*e**3*f*g**3 + 2*a*c*d**2*e**2*f*g**3 + 2*a*c*d*e**3*f**2
*g**2 + b**2*d**2*e**2*f*g**3 + b**2*d*e**3*f**2*g**2 - 2*b*c*d**3*e*f*g**3 - 2*
b*c*d*e**3*f**3*g + c**2*d**4*f*g**3 + c**2*d*e**3*f**4 - d**2*e**3*g*(a*g**2 -
b*f*g + c*f**2)**2/(d*g - e*f) + 2*d*e**4*f*(a*g**2 - b*f*g + c*f**2)**2/(d*g -
e*f) - e**5*f**2*(a*g**2 - b*f*g + c*f**2)**2/(g*(d*g - e*f)))/(2*a**2*e**4*g**4
 - 2*a*b*d*e**3*g**4 - 2*a*b*e**4*f*g**3 + 2*a*c*d**2*e**2*g**4 + 2*a*c*e**4*f**
2*g**2 + b**2*d**2*e**2*g**4 + b**2*e**4*f**2*g**2 - 2*b*c*d**3*e*g**4 - 2*b*c*e
**4*f**3*g + c**2*d**4*g**4 + c**2*e**4*f**4))/(g**4*(d*g - e*f)) + x**2*(2*b*c*
e*g - c**2*d*g - c**2*e*f)/(2*e**2*g**2) + x*(2*a*c*e**2*g**2 + b**2*e**2*g**2 -
 2*b*c*d*e*g**2 - 2*b*c*e**2*f*g + c**2*d**2*g**2 + c**2*d*e*f*g + c**2*e**2*f**
2)/(e**3*g**3) - (a*e**2 - b*d*e + c*d**2)**2*log(x + (a**2*d*e**3*g**4 + a**2*e
**4*f*g**3 - 4*a*b*d*e**3*f*g**3 + 2*a*c*d**2*e**2*f*g**3 + 2*a*c*d*e**3*f**2*g*
*2 + b**2*d**2*e**2*f*g**3 + b**2*d*e**3*f**2*g**2 - 2*b*c*d**3*e*f*g**3 - 2*b*c
*d*e**3*f**3*g + c**2*d**4*f*g**3 + c**2*d*e**3*f**4 + d**2*g**5*(a*e**2 - b*d*e
 + c*d**2)**2/(e*(d*g - e*f)) - 2*d*f*g**4*(a*e**2 - b*d*e + c*d**2)**2/(d*g - e
*f) + e*f**2*g**3*(a*e**2 - b*d*e + c*d**2)**2/(d*g - e*f))/(2*a**2*e**4*g**4 -
2*a*b*d*e**3*g**4 - 2*a*b*e**4*f*g**3 + 2*a*c*d**2*e**2*g**4 + 2*a*c*e**4*f**2*g
**2 + b**2*d**2*e**2*g**4 + b**2*e**4*f**2*g**2 - 2*b*c*d**3*e*g**4 - 2*b*c*e**4
*f**3*g + c**2*d**4*g**4 + c**2*e**4*f**4))/(e**4*(d*g - e*f))

_______________________________________________________________________________________

GIAC/XCAS [F(-2)]  time = 0., size = 0, normalized size = 0. \[ \text{Exception raised: NotImplementedError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((c*x^2 + b*x + a)^2/((e*x + d)*(g*x + f)),x, algorithm="giac")

[Out]

Exception raised: NotImplementedError